package bar.dark.lee.alarm.common;

import bar.dark.lee.alarm.BDContents;
import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.Button;

public class BDButton extends Button
{

	public BDButton(Context context, AttributeSet attrs, int defStyle)
	{
		super(context, attrs, defStyle);
		setCustomFont(context, BDContents.FONT_FILE_NAME);
	}

	public BDButton(Context context, AttributeSet attrs)
	{
		super(context, attrs);
		setCustomFont(context, BDContents.FONT_FILE_NAME);
	}

	public BDButton(Context context)
	{
		super(context);
		setCustomFont(context, BDContents.FONT_FILE_NAME);
	}

	public boolean setCustomFont(Context ctx, String asset) 
	{        
		Typeface tf = null;        
		
		try {        
			tf = Typeface.createFromAsset(ctx.getAssets(), asset);
		} catch (Exception e) {            
			return false;        
		}        
		
		setTypeface(tf);          
		return true;    
		
	}
}
